package com.film.controller.account;

import com.film.service.account.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

//登陆接口
@RestController
public class LoginController{
    @Autowired
    private LoginService loginService;

    @PostMapping("/account/login")
    public Map<String, String> getToken(@RequestParam (value = "username") String username, @RequestParam (value = "password") String password) {
        System.out.println("login has been called");
        System.out.println("in login\n" + username + " " + password);
        return loginService.getToken(username, password);
    }
}
